/*
 * @Author: huangtianyang 916072572@qq.com
 * @Date: 2023-02-09 14:39:30
 * @LastEditors: error: error: git config user.name & please set dead value or install git && error: git config user.email & please set dead value or install git & please set dead value or install git
 * @LastEditTime: 2024-05-27 15:31:06
 * @FilePath: \report-h5\src\apis\report\index.ts
 */
import { request as axios } from '@/axios/index'

/**
 * 行驶证识别
 * @param data file
 * @returns
 */
export const vehicleLicenseIdentification = (data: FormData) => {
    return axios({
        method: 'post',
        url: '/api/report/vehicleLicense/front/result',
        data
    })
}
export const vehicleLicenseIdentificationBase64 = (data: FormData) => {
    return axios({
        method: 'post',
        url: '/api/report/vehicleLicense/front/result/str',
        data
    })
}

//根据vin+车牌号 查询车辆型号列表
export const getCarTypeList = (vin: string, plateNo: string) => {
    return axios({
        method: 'get',
        url: '/api/report/vinParse/parse',
        params: {
            vin,
            plateNo
        }
    })
}

/**
 * 保险产品数据接收回调
 * @returns
 */
export const insuranceDataCallback = () => {
    return axios({
        method: 'post',
        url: '/api/report/jkcredit/callback'
    })
}

export interface paramsInterface {
    current: number
    size: number
    reportStatus?: number //报告状态（0.待生成；1.成功；2.失败；3.失效）
    userId?: string
}

/**
 * 查询报告记录
 * @returns
 */
export const reportRecordList = (params: paramsInterface) => {
    return axios({
        method: 'get',
        url: '/api/report/report/pageRecords',
        params
    })
}

export interface paramsOrderInterface {
    current: number
    size: number
    companyId?: string //企业id
    orderStatus?: number //0.待付款；1.已支付；2.支付失败；3.已关闭
    productType?: number //产品类型（1.车况-出险；2.车况-维保车况；3.新能源车况电池）
    orderFlag?: number //0.升序；1.倒序
}

/**
 * 查询报告记录
 * @returns
 */
export const reportOrderList = (params: paramsOrderInterface) => {
    return axios({
        method: 'get',
        url: '/api/mall/portal/report/queryOrderPageList',
        params
    })
}

/**
 * 出险查询报告
 * @param orderNo
 * @param vin
 * @param vinParseId
 * @returns
 */
export const reportSearch = (orderNo: string, vin: string, vinParseId: string) => {
    return axios({
        method: 'get',
        url: '/api/report/report/vehicleCrash/search',
        params: {
            orderNo,
            vin,
            vinParseId
        }
    })
}

/**
 * 出险查询报告 返回html
 * @param reportId
 */
export const reportQueryReturnHTML = (reportId: string) => {
    return axios({
        method: 'get',
        url: '/api/report/report/vehicleCrash/details/info',
        params: {
            reportId
        }
    })
}
export const reportQueryReturnHTML_Two = (reportId: string) => {
    return axios({
        method: 'get',
        url: `/api/report/qucent/review/${reportId}`
    })
}
/**
 * 新能源车况电池查询
 * @param orderNo
 * @param vin
 * @param vinParseId
 * @returns
 */
export const reportSearchBattery = (orderNo: string, vin: string, vinParseId: string) => {
    return axios({
        method: 'get',
        url: '/api/report/report/vehicleBattery/search',
        params: {
            orderNo,
            vin,
            vinParseId
        }
    })
}
/**
 * 维保车况查询报告
 * @param orderNo
 * @returns
 */
export const reportSearchWEIBAO = (orderNo: string) => {
    return axios({
        method: 'get',
        url: '/api/report/report/maintenance/search',
        params: {
            orderNo
        }
    })
}

/**
 * 根据报告id查询报告详情
 * @param reportId
 * @returns
 */
// export const reportDetailed = (reportId: string) => {
//     return axios({
//         method: 'get',
//         url: '/api/report/report/details/info',
//         params: { reportId }
//     })
// }

/**
 * 根据报告id查询车辆事故相关数据
 * @param reportId
 * @returns
 */
export const vehicleAccidents = (reportId: string) => {
    return axios({
        method: 'get',
        url: '/api/report/report/details/vehicle/accident/info',
        params: { reportId }
    })
}

/**
 * 根据报告id 获取车辆风险提示含外观展示相关数据
 * @param reportId
 * @returns
 */
export const vehicleRisk = (reportId: string) => {
    return axios({
        method: 'get',
        url: '/api/report/report/details/vehicle/damage',
        params: { reportId }
    })
}

/**
 * 根据报告id 获取车辆基础信息
 * @param reportId
 * @returns
 */
export const vehicleInformation = (reportId: string) => {
    return axios({
        method: 'get',
        url: '/api/report/report/details/vehicle/details',
        params: { reportId }
    })
}

/**
 * 根据报告id 获取车辆保险
 * @param reportId
 * @returns
 */
export const automobileInsurance = (reportId: string) => {
    return axios({
        method: 'get',
        url: '/api/report/report/details/vehicle/insurance',
        params: { reportId }
    })
}

/**
 * 根据报告id 查询车况统计
 * @param reportId
 * @returns
 */
export const vehicleCondition = (reportId: string) => {
    return axios({
        method: 'get',
        url: '/api/report/report/details/vehicle/statistics',
        params: { reportId }
    })
}
/**
 * 检查该行驶证是否支持查询
 * @param plateNo
 * @param vin
 * @param vinParseId
 * @returns
 */
export const checkQuery = (plateNo: string, vin: string, vinParseId: string) => {
    return axios({
        method: 'post',
        url: '/api/report/report/maintenance/check',
        data: { plateNo, vin, vinParseId }
    })
}

/**
 * 获取分享数据
 * @param reportId
 * @returns
 */
export const getShareData = (reportId: string) => {
    return axios({
        method: 'get',
        url: '/api/report/report/queryShareInfo',
        params: {
            reportId
        }
    })
}

/**
 * vin码解析数据查询
 * @param vinParseId
 * @returns
 */
export const vinParse = (vinParseId: string) => {
    return axios({
        method: 'get',
        url: '/api/report/vinParse/query',
        params: { vinParseId }
    })
}

/**
 * 获取报告详细信息
 * @param reportId
 * @returns
 */
export const getReportDetailed = (reportId: string) => {
    return axios({
        method: 'get',
        url: '/api/report/report/vehicleCrash/details/all/info',
        params: { reportId }
    })
}

/**
 * 根据报告id 查询新能源车况报告
 * @param reportId
 * @returns
 */
export const getReportBatteryDetailed = (reportId: string) => {
    return axios({
        method: 'get',
        url: '/api/report/report/vehicleBattery/details/all/info',
        params: { reportId }
    })
}

/**
 * 用户手动修改vin
 * @param key
 * @param vin
 * @returns
 */
export const updateVin = (key: string, vin: string) => {
    return axios({
        method: 'post',
        url: '/api/report/vehicleLicense/front/result/update',
        params: { key, vin }
    })
}
